package org.dant.ant.extension.net.rmi;

import java.rmi.Naming;

import org.dant.ant.extension.net.NetConstants;
import org.dant.ant.extension.net.RemoteHelper;
import org.dant.ant.extension.tasks.internal.Endpoint;
import org.dant.ant.extension.tasks.internal.RemoteCommand;
import org.dant.ant.extension.tasks.internal.RemoteResponse;

public class RMIHelper implements RemoteHelper {
    DistributedAnt impl;

    public RemoteResponse invoke(Endpoint destHost, RemoteCommand rCmd) throws Exception {
        impl = (DistributedAnt) Naming.lookup(destHost.getFullURL());
        return impl.remoteCall(rCmd);
    }

    public String getProtocol() {
        return NetConstants.DEFAULT_PROTOCOL;
    }

    public String getPath() {
        return NetConstants.DEFAULT_PATH;
    }
  
}
